<?php
class HotPosts extends SideList
{
    public $title = "Hot";
    
    public $limit = 10;
    
    public function getItems()
    {
        return $models = Post::model()->findAll(array(
            'condition' => 'publish = true',
            'select' => 'id,title',
            'order' => 'click_num desc',
            'limit' => $this->limit,
        ));
    }
    
    public function getUrl($model)
    {
        return CHtml::link($model->title, array('/index/view', 'id' => $model->id));
    }
}